#include <bits/stdc++.h>
using namespace std;
struct p{
    int id, s;
}pp[5005];
bool cmp(p x, p y){
    if (x.s != y.s) return x.s > y.s;
    else return x.id < y.id;
}
int main(){
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++){
        cin >> pp[i].id >> pp[i].s;
    }
    sort(pp + 1, pp + n + 1, cmp);
    m = m * 1.5;
    int cj = pp[m].s;
    while (pp[m+1].s == cj){
        m++;
    }
    cout << cj << " " << m << endl;
    for (int i = 1;i <= m; i++){
        cout << pp[i].id << " " << pp[i].s << endl;
    }
    return 0;
}